package com.chagee.store.operation.server.facade;

import com.chagee.base.utils.*;
import com.chagee.store.operation.api.request.*;
import com.chagee.store.operation.api.response.SettlementResponse;
import com.chagee.store.operation.api.response.WorkOrderResponse;
import com.chagee.store.operation.server.service.biz.StoreSettlementBizService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 打烊结算
 * @Author : hk
 * @Date : 2024/10/14
 */

@Slf4j
@Service
@RequiredArgsConstructor
public class StoreSettlementFacade {

	@Resource
	private StoreSettlementBizService storeSettlementBizService;


	/**
	 * 供应商列表
	 */
	public PaginationData<SupplierPageQueryResponse> querySupplier(PaginationRequest<QuerySupplierRequest> request){
		return storeSettlementBizService.querySupplier(request);
	}

	/**
	 * 结算单列表/查询
	 */
	public PaginationData<SettlementResponse> query(PaginationRequest<SettlementRequest> request){
		return storeSettlementBizService.querySettlementPage(request);
	}

	/**
	 * 结算单详情
	 */
	public SettlementResponse settlementDetail(SettlementDetailRequest request){
		return storeSettlementBizService.settlementDetail(request);
	}

	/**
	 * 导出打烊结算单
	 */
	public void export(SettlementRequest taskListParam, HttpServletRequest request, HttpServletResponse response, ModelMap map){
		storeSettlementBizService.export(taskListParam,request,response,map);
	}

	public HttpResponse<Boolean> updateStoreArea(UpdateStoreAreaRequest request){
		return storeSettlementBizService.updateStoreArea(request);
	}

	public HttpResponse<Boolean> updateLineNum(UpdateStoreAreaRequest request){
		return storeSettlementBizService.updateLineNum(request);
	}

	public PaginationData<WorkOrderResponse> queryOrderList(PaginationRequest<SettlementOrderRequest> request){
		return storeSettlementBizService.queryOrderList(request);
	}

	/**
	 * 工单列表导出
	 */
	public void orderExport(SettlementOrderRequest orderRequest, HttpServletRequest request, HttpServletResponse response, ModelMap map) {
		storeSettlementBizService.orderExport(orderRequest, request, response, map);
	}

	public Boolean settlementAdjust(AdjustMoneyRequest request) {
		return storeSettlementBizService.settlementAdjust(request);
	}

	public String getUploadInvoiceUrl(InvoiceRequest request) {
		return storeSettlementBizService.getUploadInvoiceUrl(request);
	}

	//发票回调信息
	public Boolean invoiceCallback(InvoiceCallbackRequest request) {
		Boolean callback = storeSettlementBizService.invoiceCallback(request);
		return callback;
	}

	public Boolean issued(SettlementIssuedRequest request) {
		return storeSettlementBizService.issued(request);
	}
}
